from django.db import models

# Create your models here.
class User_info(models.Model):

    email = models.EmailField()
    password = models.CharField(max_length=160)
    state = models.SmallIntegerField(default=0)
    cr_time = models.DateTimeField(verbose_name='创建时间',auto_now_add=True)
    up_time = models.DateTimeField(verbose_name='更新时间',auto_now=True)

    class Meta:
        db_table = 'user'

class UserDetail(models.Model):

    nickname = models.CharField(verbose_name='昵称',max_length=60,null=True,unique=True)
    portrait = models.TextField(verbose_name='头像',null=True)
    sex = models.SmallIntegerField(default=0)
    age = models.SmallIntegerField(null=True)
    bth = models.DateField(verbose_name='生日',null=True)
    phone = models.CharField(max_length=11,null=True,unique=True)
    addr = models.CharField(verbose_name='地址',max_length=30,null=True)
    fav = models.CharField(verbose_name='爱好',max_length=30,null=True)
    ps = models.CharField(verbose_name='性格',max_length=160,null=True)
    user = models.OneToOneField('User_info',on_delete=models.CASCADE,related_name='detail')

    class Meta:
        db_table = 'detail'